package com.leiyuee.mybatis.controller;

import com.leiyuee.mybatis.entity.IUser;
import com.leiyuee.mybatis.service.IUserService;
import com.leiyuee.mybatis.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.ResultSet;
import java.util.List;

@RestController("user")
public class UserController {

    @Autowired
    private IUserService iUserService;

    @RequestMapping("saveU")
    public Result saveU(IUser iUser){
        iUserService.insert(iUser);
        return Result.ok();
    }

    @RequestMapping
    public  Result queryList(IUser iUser){

        List list = iUserService.selectAll();
        return Result.ok(list);
    }
}
